  <%@page import="com.dsz.entity.Companyinfo"%>
<%@ page language="java" import="java.util.*,com.dsz.entity.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
  <head>
    <base href="<%=basePath%>">
    <title>四色火无限集团</title>
    ﻿<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="format-detection" content="telephone=no">
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link rel="alternate icon" type="image/png" href="images/favicon.png">
<link rel='icon' href='favicon.ico' type='image/x-ico' />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link rel="stylesheet" href="css/default.min.css?t=227" />
<!--[if (gte IE 9)|!(IE)]><!-->
<script type="text/javascript" src="lib/jquery/jquery.min.js"></script>
<!--<![endif]-->
<!--[if lte IE 8 ]>
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="lib/amazeui/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
<script type="text/javascript" src="lib/handlebars/handlebars.min.js"></script>
<script type="text/javascript" src="lib/iscroll/iscroll-probe.js"></script>
<script type="text/javascript" src="lib/amazeui/amazeui.min.js"></script>
<script type="text/javascript" src="lib/raty/jquery.raty.js"></script>
<script type="text/javascript" src="js/main.min.js?t=1"></script>
<script type="text/javascript">
    window.onload=function(){
    var n = <%=request.getParameter("n")%>
      if(n!=null){
         if(n>0){
            alert("留言成功");
         }else{
            alert("留言失败");
         }
    }  
    }
    
    function checkA(){
    	var username = document.getElementById("username").value;
    	if(username.length>=2){
    		document.getElementById("username").style="";
    	    document.getElementById("t1").innerHTML = "";
    		return true;
    	}else{
    	    document.getElementById("t1").innerHTML = "姓名不能少于2个字符";
    		document.getElementById("username").style="border:1px solid red";
    		return false;
    	}
    	
    	
    }
    function checkB(){
    	var tel = document.getElementById("tel").value;
    	var dh = /^[1]+[3,5,7,9,8]+\d{9}$/;
    	if(dh.test(tel)){
    	    document.getElementById("t2").innerHTML = "";
    		document.getElementById("tel").style="";
    		return true;
    	}else{
    	    document.getElementById("t2").innerHTML = "请输入正确的电话号码";
    		document.getElementById("tel").style="border:1px solid red";
    		return false;
    	}
    }
    function checkC(){
    	var email = document.getElementById("email").value;
    	var yx = /^[A-Za-z\d]+([-_.][A-Za-z\d]+)*@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$/;
    	if(yx.test(email)){
    	    document.getElementById("t3").innerHTML = "";
    		document.getElementById("email").style="";
    		return true;
    	}else{
    	    document.getElementById("t3").innerHTML = "请输入正确的邮箱";
    		document.getElementById("email").style="border:1px solid red";
    		return false;
    	}
    	}
    function checkD(){
    	var content = document.getElementById("content").value;
    	
    	if(content!=""){
    		document.getElementById("content").style="";
    		return true;
    	}else{
    		document.getElementById("content").style="border:1px solid red";
    		return false;
    	}
    	}
    function checkAll(){
    	/* var username = document.getElementById("username").value;
    	var tel = document.getElementById("tel").value;
    	var email = document.getElementById("email").value;
    	var content = document.getElementById("content").value;
    	if(username&&tel&&email&&content!=""){
    		return true;
    	}else{
    		alert("内容不允许为空");
    		return false;
    	} */
    	if(checkA()&checkB()&checkC()&checkD()){
    	return true;
    	}else{
    	alert("留言失败");
    	return false;
    	}
    	
    }
    
</script>
<style type="text/css">
			.error {
				border: 1px solid red;
			}
		</style>
</head>
<body>
<%Companyinfo comp = (Companyinfo)request.getAttribute("comp"); %>
	<jsp:include page="head.jsp"></jsp:include>
<div>
    <header class="header-article-list">
        <h1>在线留言</h1>

    </header>
<div>
   <form action="MessageServlet?oid=2" class="message-form" method="post" onSubmit="return checkAll()">

       <label>姓名
           <input type="text" name="username" id="username" onblur="checkA()">
           <span>*</span>  <span id="t1"></span>
       </label>


       <label>电话
           <input type="text" name="tel" id="tel" onblur="checkB()">
           <span>*</span><span id="t2"></span>
       </label>


       <label>邮箱
           <input type="email" name="email" id="email" onblur="checkC()">
           <span>*</span><span id="t3"></span>
       </label>


       <label>内容
           <textarea name="content" id="content" onblur="checkD()"></textarea>
           <span>*</span><span id="t4"></span>
       </label>


       <button type="submit" class="am-btn am-btn-danger">提交</button>
   </form>
</div>
</div>
<jsp:include page="footer.jsp"></jsp:include>
<%-- ﻿<footer>
    <div>
        <div class="footer-info">
            <div class="footer-content">
                <img src="images/qccode.png" alt="">
               <div>
                <p>招商热线:<%=comp.getTel() %></p>
                <div class="footer-box">
                    <i class="icon-tel"></i>
                    <span>公司电话:</span>
                    <span><%=comp.getTel() %></span>
                </div>
                <div class="footer-box">
                    <i class="icon-email"></i>
                    <span>公司邮箱:</span>
                    <span><%=comp.getEmail() %></span>
                </div>
                <div class="footer-box">
                    <i class="icon-address"></i>
                    <span>公司地址:</span>
                    <span><%=comp.getAddress() %></span>
                </div>
               </div>
            </div>
        </div>
        <style>
        .footer-bottom a{color:#F1404B}
        </style>
        <div class="footer-bottom"><div style="text-align:center;color:#fff;line-height:100px;"><span><a href="http://www.haothemes.com/" target="_blank" title="好主题">好主题</a>提供 - More Templates <a href="http://www.cssmoban.com/" target="_blank" title="模板之家">模板之家</a> - Collect from <a href="http://www.cssmoban.com/" title="网页模板" target="_blank">网页模板</a></span></div></div>
    </div>
</footer> --%>
</body>
</html>